



function install_perl_cpan () {
    for item in {perl,cpan}; do
        apt-get -y install ${item}
    done
}

function install_gcc(){
    yum -y install gcc-c++
}

function install_openmpi(){
    tar -zxvf openmpi-3.1.0.tar.gz
    cd openmpi-3.1.0/
    ./configure
    make && make install    
}

function config_env(){
    MPIPATH=$(whereis openmpi | awk '{print $2}')
    echo "export PATH=\$PATH:/usr/local/lib/$MPIPATH" >> ~/.bash_profile
    echo "export LD_LIBRARY_PATH=\$PATH:/usr/local/lib/$MPIPATH" >> ~/.bash_profile
    source ~/.bash_profile
}

install_perl_cpan
# install_gcc
install_openmpi
config_env